import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:logger/logger.dart';

class AssetsRoute extends StatefulWidget {
  const AssetsRoute({Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() => _AssetsRouteState();
}

class _AssetsRouteState extends State<AssetsRoute> {
  final logger = Logger(printer: PrettyPrinter());

  @override
  void initState() {
    super.initState();
    loadChinaAreaJson();
  }

  void loadChinaAreaJson() async {
    var json = await rootBundle.loadString("assets/jsons/ChinaArea.json");
    logger.i("ChinaAreaJson  : $json");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("资源管理"),
      ),
      body: Container(
        decoration: const BoxDecoration(
          image: DecorationImage(
            fit: BoxFit.cover,
            image: AssetImage("assets/images/01e6e1f2.jpg"),
          ),
        ),
        child: Container(
          color: Colors.red.withOpacity(.5),
          child: const Center(
            child: Text(
              "我在图片的上面哦~",
              style: TextStyle(color: Colors.white, fontSize: 33),
            ),
          ),
        ),
      ),
    );
  }
}
